package com.crazy.bookstore.controller;

import com.crazy.bookstore.common.ApiRestResponse;
import com.crazy.bookstore.entity.Category;
import com.crazy.bookstore.service.CategoryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: 卢辉宇
 * @date: 2022/12/27 13:31
 * @description:
 */
@RestController
@RequestMapping("/category")
public class CategoryController {

    @Resource
    CategoryService categoryService;

    @GetMapping("/list")
    public ApiRestResponse list(){
        /*调用service层的查询全部目录业务。。。*/
        List<Category> categories = categoryService.selectAll();
        return ApiRestResponse.seccess(categories);
    }

}
